<template>
	<view class="page mine-setting">
		<nav-header title="设置" :showRight="false" bg-color="#FAFAFA" :show-border="false">
		</nav-header>

		<view class="setting">
			<view class="friend-txl">
				<view class="txl" @click="goUserInfo">
					<view class="txl-left">
						<!-- <img :src="getResource('/icon/my.svg')" alt="" class="txl-img" /> -->
						<text class="text-md-Regular">账户信息</text>
					</view>
					<view class="txl-right">
						<svg-icon icon="arrowRight" :width="32"></svg-icon>
					</view>
				</view>
			</view>
			
			<view class="friend-txl">
				<view class="txl" @click="goaddress">
					<view class="txl-left">
						<!-- <img :src="getResource('/icon/my.svg')" alt="" class="txl-img" /> -->
						<text class="text-md-Regular">收货地址</text>
					</view>
					<view class="txl-right">
						<svg-icon icon="arrowRight" :width="32"></svg-icon>
					</view>
				</view>
			</view>

			<view class="friend-txl">
				<view class="txl" @click="goKeFu">
					<view class="txl-left">
						<!-- <img :src="getResource('/icon/kf.svg')" alt="" class="txl-img" /> -->
						<text class="text-md-Regular">联系客服</text>
					</view>
					<view class="txl-right">
						<svg-icon icon="arrowRight" :width="32"></svg-icon>
					</view>
				</view>
				<view class="txl" @click="goQuestion">
					<view class="txl-left">
						<!-- <img :src="getResource('/icon/gth.svg')" alt="" class="txl-img" /> -->
						<text class="text-md-Regular">报告问题</text>
					</view>
					<view class="txl-right">
						<svg-icon icon="arrowRight" :width="32"></svg-icon>
					</view>
				</view>
			</view>
			<view class="friend-txl">
				<view class="txl" @click="onModifyPassword()">
					<view class="txl-left">
						<!-- <img :src="getResource('/icon/kf.svg')" alt="" class="txl-img" /> -->
						<text class="text-md-Regular">修改密码</text>
					</view>
					<view class="txl-right">
						<svg-icon icon="arrowRight" :width="32"></svg-icon>
					</view>
				</view>
				<view class="txl" @click="goprivacy()">
					<view class="txl-left">
						<!-- <img :src="getResource('/icon/gth.svg')" alt="" class="txl-img" /> -->
						<text class="text-md-Regular">隐私政策</text>
					</view>
					<view class="txl-right">
						<svg-icon icon="arrowRight" :width="32"></svg-icon>
					</view>
				</view>
			</view>

			<view class="friend-txl">
				<view class="txl" @click="goWay">
					<view class="txl-left">
						<!-- <svg-icon icon="add-way"></svg-icon> -->
						<text class="text-md-Regular">加我为好友的方式</text>
					</view>
					<view class="txl-right">
						<svg-icon icon="arrowRight" :width="32"></svg-icon>
					</view>
				</view>
				<!-- <view class="txl" @click="goFind">
					<view class="txl-left">
						<text class="text-md-Regular">发现我的方式</text>
					</view>
					<view class="txl-right">
						<svg-icon icon="arrowRight" :width="32"></svg-icon>
					</view>
				</view> -->
			</view>
		</view>

		<view class="btn-group">
			<view class="btn-list">
				<up-button type="primary" @click="writeoff()">注销账号</up-button>
				<up-button class="" type="error" @click="onQuit()">退出</up-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			onModifyPassword() {
				uni.navigateTo({
					url: "/pageSubOne/mine/mine-password"
				})
			},
			goaddress(){
				uni.navigateTo({
					url: "/pageSubOne/mine/mine-shippAddress"
				})
			},
			goprivacy(){
				uni.navigateTo({
					url: "/pageSubOne/agree/privacy/privacy"
				})
			},
			goUserInfo() {
				uni.navigateTo({
					url: "/pageSubOne/mine/mine-info"
				})
			},
			goKeFu() {
				uni.makePhoneCall({
					phoneNumber:"13712047712",
				})
				// uni.navigateTo({
				// 	url: "/pageSubOne/mine/mine-kefu"
				// })
			},
			goQuestion() {
				uni.navigateTo({
					url: "/pageSubOne/mine/mine-question"
				})
			},
			goWay() {
				uni.navigateTo({
					url: "/pageSubOne/mine/mine-add-way"
				})
			},
			goFind() {
				uni.navigateTo({
					url: "/pageSubOne/mine/mine-find-way"
				})
			},
			onQuit() {
				uni.showModal({
					title: '确认退出?',
					success: (res) => {
						if (res.confirm) {
							console.log(getApp())
							getApp().$vm.exit()
						}
					}
				});
			},
			writeoff(){
				uni.showModal({
					title: '确认注销账号吗?',
					success: (res) => {
						if (res.confirm) {
							this.$http({
								url: "/deleteAccount",
								method: "delete",
							}).then(() => {
								uni.showToast({
									title: "注销成功",
									icon: 'none'
								});
								getApp().$vm.exit()
							})
							
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.mine-setting {
		width: 100vw;
		height: 100vh;

		.setting {
			padding: 16rpx 0;
		}

		.friend-txl {
			width: 100%;
			background-color: $white;

			.txl {
				padding: 24rpx 32rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.txl-left {
					display: flex;
					align-items: center;
					color: $gray-900;
				}
			}
		}

		.btn-group {
			position: fixed;
			bottom: 42rpx;
			// margin: 100rpx;
			width: 100%;

			.btn-list {
				display: flex;
				flex-direction: column;
				gap: 10px;
				width: 90%;
				margin: 0 auto;

				.btn {
					margin: 40rpx;
					margin-top: 20rpx;
					font-size: 30rpx;
				}

				.btncolor {
					background-color: #048df5;
					color: #fff;
				}
			}
		}
	}
</style>